const Mock = require('mockjs')

const Random = Mock.Random

let Result = {
  code: 200,
  msg: '操作成功',
  data: null
}


Mock.mock('/captcha', 'get', () => {
  Result.data = {
    token: Random.string(32),
    captchaImg: Random.dataImage('90x40', 'p7n5w')
  }
  return Result
})

Mock.mock('/login', 'post', () => {

  // Result.code = 400
  // Result.msg = "验证码错误"
  return Result
})

Mock.mock('/sys/userInfo', 'get', () => {
  Result.data = {
    id: "1",
    username: "test",
    avatar: ""
  }
  return Result
})

Mock.mock('/logout', 'post', () => {

  return Result
})

Mock.mock('/sys/menu/nav', 'post', () => {

  let nav=[
    {
      name: 'SysManga',
      title: '系统管理',
      icon: 'el-icon-s-operation',
      component:'sys/User',
      path: '',
      children: [
        {
          name: 'SysUser',
          title: '用户管理',
          icon: 'el-icon-s-custom',
          path: '/sys/users',
          children: []
        }
      ]
    },
    {
      name: 'SysTools',
      title: '系统工具',
      icon: 'el-icon-s-tools',
      path: '',
      children: [
        {
          name: 'SysDict',
          title: '数字字典',
          icon: 'el-icon-s-order',
          path: '/sys/dicts',
          children: []
        },
      ]
    }
  ]

  let authoritys=[]

  Result.data={
    nav:nav,
    authoritys: authoritys

  }

  return Result
})


